<?php

if ($_SERVER["REQUEST_METHOD"] == "GET") {
    print_r(json_encode(array("msg" => "不支持get请求", "status" => -1)));
    return;
}

session_start();
if(!isset($_SESSION["usermessage"])){
    $result=array("msg"=>"请先登录","status"=>-2);
    print_r(json_encode($result));
    return;
}

$cid = $_REQUEST["cid"];


include "./DBhelper.php";

//如果已经购买了 修改数量
$delete = "DELETE FROM carslist WHERE  id='".$cid."'";

$resultData = sqlQuery($delete); //更新的结果
if ($resultData == 1) {
    print_r(json_encode(array("msg" => "删除成功", "status" => 1)));
} else {
    print_r(json_encode(array("msg" => "删除失败", "status" => -3)));
}